import React, { Component } from 'react'
import AppHeader from './header'
import AppMenu from './menu'
import { Menu, Dropdown,message } from 'antd';
import { DownOutlined,UserOutlined } from '@ant-design/icons';
import {withRouter} from "react-router-dom";
import './layout.scss';
class Layout extends Component {
  
  render() {
    let editClick = (params) => {
      message.info('你点击了编辑嗷')
    };
    let outClick = (params) => {
      console.log(this,'============');
      this.props.history.push('/')
    };

    return (
      <div className="app_layout">
        <div className="app_head">
          <AppHeader left={<div className="app_logo">logo</div>} right={
            <Dropdown overlay={
              <Menu>
                <Menu.Item key="1" onClick={editClick}><div>编辑</div></Menu.Item>
                <Menu.Item key="2" onClick={outClick}>退出</Menu.Item>
              </Menu>
            }>
              <span className="right_link" onClick={e => e.preventDefault()}>
              <UserOutlined /> <DownOutlined />
              </span>
            </Dropdown>
          } />
        </div>
        <div className="app_menu">
          <AppMenu />
        </div>
        <div className="app_content">
          {this.props.children}
        </div>
      </div>
    );
  }

}
export default withRouter(Layout)